Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rpc] add limit to object_ids #2701

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Conversation

vegetabledogdog
Copy link
Contributor

avoid oom

Copy link

vercel bot commented Sep 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal-v2.1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 4:45am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Sep 27, 2024 4:45am

@@ -122,6 +122,7 @@ impl RpcService {
access_path: AccessPath,
state_root: Option<H256>,
) -> Result<Vec<Option<ObjectState>>> {
access_path.validate_max_object_ids()?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以考虑把 access_path 的校验放到 rpc_server中完成,rpc_server是 rpc 的入口层,参数校验都可以在这一层完成

@@ -291,6 +291,19 @@ impl AccessPath {
})
}

pub fn validate_max_object_ids(&self) -> Result<()> {
const MAX_OBJECT_IDS: usize = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议定义成全局的pub const,用于 object ids 的判断

@baichuan3 baichuan3 merged commit e7e0453 into rooch-network:main Sep 27, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants